# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: eolianoe <eolianoe At GoogleMAIL DoT com>
# Contributor: Andrey Mikhaylenko <neithere at gmail dot com>

pkgname=python-pkginfo
_pkgname="${pkgname#python-}"
pkgver=1.9.6
pkgrel=2
pkgdesc='Query metadata from sdists / bdists / installed packages'
arch=('any')
url='https://pypi.python.org/pypi/pkginfo'
license=('MIT')
depends=('python')
makedepends=(
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
)
checkdepends=('python-pytest')
source=("$pkgname-$pkgver.tar.gz::https://pypi.io/packages/source/p/pkginfo/pkginfo-$pkgver.tar.gz")
sha512sums=('07d9b8ce9965572b84ddced107aa1fcd2ed20a485580f87d667bd53508b0a8fc3aef2ca900bf8bb7fc075b95a81512920c4eef513c9ee6582d61b09968efee08')
b2sums=('a063e3461aecabac5bf35a9eb6b9f59a24865f3eeb903f69538a6e625893f506a897df7199d647539405bdd383b10722f5b0048380cc8ce8b6a8b4e7b2016c54')

build() {
  cd "$_pkgname-$pkgver"

  python -m build --wheel --no-isolation
}

check() {
  cd "$_pkgname-$pkgver"

  pytest -v
}

package() {
  cd "$_pkgname-$pkgver"

  python -m installer --destdir="$pkgdir" dist/*.whl

  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE.txt
}
